﻿<phone:PhoneApplicationPage x:Class="DepSoft.Mobile.WP7.FollwIt.View.UserProfilePage"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:DepSoftFollwItFramework="clr-namespace:DepSoft.Mobile.WP7.FollwIt.Framework"
                            xmlns:gsextra="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
                            xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                            xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            FontFamily="{StaticResource PhoneFontFamilyNormal}"
                            FontSize="{StaticResource PhoneFontSizeNormal}"
                            Foreground="{StaticResource PhoneForegroundBrush}"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            mc:Ignorable="d"
                            d:DesignWidth="480"
                            d:DesignHeight="768"
                            shell:SystemTray.IsVisible="True"
                            DataContext="{Binding UserProfileViewModel, Source={StaticResource Locator}}">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--<interactivity:Interaction.Triggers>
        <interactivity:EventTrigger EventName="BackKeyPress">
            <gsextra:EventToCommand Command="{Binding BackKeyPressCommand}" PassEventArgsToCommand="True" />
        </interactivity:EventTrigger>
    </interactivity:Interaction.Triggers>-->

    <phone:PhoneApplicationPage.Resources>
		<DataTemplate x:Key="ItemTemplate">
			<StackPanel>
                <toolkit:HubTile Title="{Binding UserName}"                                 
                                 Source="{Binding Avatar}"
                                 Margin="6,6,6,6"
                                 toolkit:TiltEffect.IsTiltEnabled="True"
                                 >
                    <interactivity:Interaction.Triggers>
                        <interactivity:EventTrigger EventName="Tap">
                            <gsextra:EventToCommand Command="{Binding Path=UserProfileViewModel.SelectedFriendCommand, Source={StaticResource Locator}}"
                                                    CommandParameter="{Binding UserName}" />
                        </interactivity:EventTrigger>
                    </interactivity:Interaction.Triggers>
                </toolkit:HubTile>
            </StackPanel>
		</DataTemplate>
		<ItemsPanelTemplate x:Key="ItemsPanelTemplate">
			<toolkit:WrapPanel/>
		</ItemsPanelTemplate>
	</phone:PhoneApplicationPage.Resources>

    <shell:SystemTray.ProgressIndicator>
        <shell:ProgressIndicator x:Name="progressOverlay"
                                 IsIndeterminate="{Binding ProgressIndicatorVisible}"
                                 IsVisible="{Binding ProgressIndicatorVisible}" />
    </shell:SystemTray.ProgressIndicator>

    <Grid x:Name="LayoutRoot" Background="{StaticResource PageBackgroundBrush}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
		</Grid.RowDefinitions>

        <Image HorizontalAlignment="Right" VerticalAlignment="Top" Source="/ApplicationIcon.png" Width="62"/>
        
		<StackPanel x:Name="TitlePanel"
		            Grid.Row="0"
		            >
			<TextBlock x:Name="ApplicationTitle"
			           Text="{Binding ApplicationTitle}"
			           Style="{StaticResource PhoneTextNormalStyle}"
                       Margin="24,18,0,0"/>
			<TextBlock x:Name="PageTitle"
			           Text="{Binding PageName}"			           
			           Style="{StaticResource PhoneTextTitle1Style}"
                       Margin="21,-8,-3,0"/>
		</StackPanel>

		<Grid x:Name="ContentGrid"
		      Grid.Row="1">
			<ListBox x:Name="TileList"
					 ItemTemplate="{StaticResource ItemTemplate}"
					 ItemsSource="{Binding Path=Friends.Friends}"
					 ItemsPanel="{StaticResource ItemsPanelTemplate}"
					 Margin="18,18,0,0"/>
        </Grid>
	</Grid>
    
	<!-- Sample code showing usage of ApplicationBar
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/appbar_button1.png" Text="Button 1"></shell:ApplicationBarIconButton>
            <shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/Images/appbar_button2.png" Text="Button 2"></shell:ApplicationBarIconButton>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1"></shell:ApplicationBarMenuItem>
                <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2"></shell:ApplicationBarMenuItem>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    -->


</phone:PhoneApplicationPage>